comparison forum/Themes/babylon/index.template.php @ 76:e3e11437ecea website

Add forum code
author Chris Cannam
date Sun, 07 Jul 2013 11:25:48 +0200
parents
children
comparison
equal deleted inserted replaced
75:72f59aa7e503 76:e3e11437ecea
1 <?php
2 // Version: 1.1; index
3
4 /* This template is, perhaps, the most important template in the theme. It
5 contains the main template layer that displays the header and footer of
6 the forum, namely with main_above and main_below. It also contains the
7 menu sub template, which appropriately displays the menu; the init sub
8 template, which is there to set the theme up; (init can be missing.) and
9 the linktree sub template, which sorts out the link tree.
10
11 The init sub template should load any data and set any hardcoded options.
12
13 The main_above sub template is what is shown above the main content, and
14 should contain anything that should be shown up there.
15
16 The main_below sub template, conversely, is shown after the main content.
17 It should probably contain the copyright statement and some other things.
18
19 The linktree sub template should display the link tree, using the data
20 in the $context['linktree'] variable.
21
22 The menu sub template should display all the relevant buttons the user
23 wants and or needs.
24
25 For more information on the templating system, please see the site at:
26 http://www.simplemachines.org/
27 */
28
29 // Initialize the template... mainly little settings.
30 function template_init()
31 {
32 global $context, $settings, $options, $txt;
33
34 /* Use images from default theme when using templates from the default theme?
35 if this is 'always', images from the default theme will be used.
36 if this is 'defaults', images from the default theme will only be used with default templates.
37 if this is 'never' or isn't set at all, images from the default theme will not be used. */
38 $settings['use_default_images'] = 'never';
39
40 /* What document type definition is being used? (for font size and other issues.)
41 'xhtml' for an XHTML 1.0 document type definition.
42 'html' for an HTML 4.01 document type definition. */
43 $settings['doctype'] = 'xhtml';
44
45 /* The version this template/theme is for.
46 This should probably be the version of SMF it was created for. */
47 $settings['theme_version'] = '1.1';
48
49 /* Set a setting that tells the theme that it can render the tabs. */
50 $settings['use_tabs'] = false;
51
52 /* Use plain buttons - as oppossed to text buttons? */
53 $settings['use_buttons'] = false;
54
55 /* Show sticky and lock status seperate from topic icons? */
56 $settings['seperate_sticky_lock'] = false;
57 }
58
59 // The main sub template above the content.
60 function template_main_above()
61 {
62 global $context, $settings, $options, $scripturl, $txt, $modSettings;
63
64 // Show right to left and the character set for ease of translating.
65 echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
66 <html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '><head>
67 <meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />
68 <meta name="description" content="', $context['page_title'], '" />', empty($context['robot_no_index']) ? '' : '
69 <meta name="robots" content="noindex" />', '
70 <meta name="keywords" content="PHP, MySQL, bulletin, board, free, open, source, smf, simple, machines, forum" />
71 <script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/script.js?fin11"></script>
72 <script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
73 var smf_theme_url = "', $settings['theme_url'], '";
74 var smf_images_url = "', $settings['images_url'], '";
75 var smf_scripturl = "', $scripturl, '";
76 var smf_iso_case_folding = ', $context['server']['iso_case_folding'] ? 'true' : 'false', ';
77 var smf_charset = "', $context['character_set'], '";
78 // ]]></script>
79 <title>', $context['page_title'], '</title>';
80
81 // The ?fin11 part of this link is just here to make sure browsers don't cache it wrongly.
82 echo '
83 <link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/style.css?fin11" />
84 <link rel="stylesheet" type="text/css" href="', $settings['default_theme_url'], '/print.css?fin11" media="print" />';
85
86 /* Internet Explorer 4/5 and Opera 6 just don't do font sizes properly. (they are big...)
87 Thus, in Internet Explorer 4, 5, and Opera 6 this will show fonts one size smaller than usual.
88 Note that this is affected by whether IE 6 is in standards compliance mode.. if not, it will also be big.
89 Standards compliance mode happens when you use xhtml... */
90 if ($context['browser']['needs_size_fix'])
91 echo '
92 <link rel="stylesheet" type="text/css" href="', $settings['default_theme_url'], '/fonts-compat.css" />';
93
94 // Show all the relative links, such as help, search, contents, and the like.
95 echo '
96 <link rel="help" href="', $scripturl, '?action=help" target="_blank" />
97 <link rel="search" href="' . $scripturl . '?action=search" />
98 <link rel="contents" href="', $scripturl, '" />';
99
100 // If RSS feeds are enabled, advertise the presence of one.
101 if (!empty($modSettings['xmlnews_enable']))
102 echo '
103 <link rel="alternate" type="application/rss+xml" title="', $context['forum_name'], ' - RSS" href="', $scripturl, '?type=rss;action=.xml" />';
104
105 // If we're viewing a topic, these should be the previous and next topics, respectively.
106 if (!empty($context['current_topic']))
107 echo '
108 <link rel="prev" href="', $scripturl, '?topic=', $context['current_topic'], '.0;prev_next=prev" />
109 <link rel="next" href="', $scripturl, '?topic=', $context['current_topic'], '.0;prev_next=next" />';
110
111 // If we're in a board, or a topic for that matter, the index will be the board's index.
112 if (!empty($context['current_board']))
113 echo '
114 <link rel="index" href="' . $scripturl . '?board=' . $context['current_board'] . '.0" />';
115
116 // We'll have to use the cookie to remember the header...
117 if ($context['user']['is_guest'])
118 $options['collapse_header'] = !empty($_COOKIE['upshrink']);
119
120 // Output any remaining HTML headers. (from mods, maybe?)
121 echo $context['html_headers'], '
122
123 <script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
124 var current_header = ', empty($options['collapse_header']) ? 'false' : 'true', ';
125
126 function shrinkHeader(mode)
127 {';
128
129 // Guests don't have theme options!!
130 if ($context['user']['is_guest'])
131 echo '
132 document.cookie = "upshrink=" + (mode ? 1 : 0);';
133 else
134 echo '
135 smf_setThemeOption("collapse_header", mode ? 1 : 0, null, "', $context['session_id'], '");';
136
137 echo '
138 document.getElementById("upshrink").src = smf_images_url + (mode ? "/upshrink2.gif" : "/upshrink.gif");
139
140 document.getElementById("upshrinkHeader").style.display = mode ? "none" : "";
141
142 current_header = mode;
143 }
144 // ]]></script>
145 </head>
146 <body>';
147
148 // Because of the way width/padding are calculated, we have to tell Internet Explorer 4 and 5 that the content should be 100% wide. (or else it will assume about 108%!)
149 echo '
150 <div id="headerarea" style="padding: 12px 30px 4px 30px;', $context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? ' width: 100%;' : '', '">';
151
152 // The logo and the three info boxes.
153 echo '
154 <table cellspacing="0" cellpadding="0" border="0" width="100%" style="position: relative;">
155 <tr>
156 <td colspan="2" valign="bottom" style="padding: 5px; white-space: nowrap;">';
157
158 // This part is the logo and forum name. You should be able to change this to whatever you want...
159 echo '
160 <img src="', $settings['images_url'], '/smflogo.gif" style="width: 250px; float: ', !$context['right_to_left'] ? 'right' : 'left', ';" alt="" />';
161 if (empty($settings['header_logo_url']))
162 echo '
163 <span style="font-family: Georgia, sans-serif; font-size: xx-large;">', $context['forum_name'], '</span>';
164 else
165 echo '
166 <img src="', $settings['header_logo_url'], '" alt="', $context['forum_name'], '" border="0" />';
167
168 echo '
169 </td>
170 </tr>
171 <tr id="upshrinkHeader"', empty($options['collapse_header']) ? '' : ' style="display: none;"', '>
172 <td valign="top">
173 <div class="headertitles" style="margin-right: 5px; position: relative;"><img src="', $settings['images_url'], '/blank.gif" height="12" alt="" /></div>
174 <div class="headerbodies" style="position: relative; margin-right: 5px; background-image: url(', $settings['images_url'], '/box_bg.gif);">
175 <img src="', $settings['images_url'], '/', $context['user']['language'], '/userinfo.gif" style="position: absolute; left: ', $context['browser']['is_ie5'] || $context['browser']['is_ie4'] ? '0' : '-1px', '; top: -16px; clear: both;" alt="" />
176 <table width="99%" cellpadding="0" cellspacing="5" border="0"><tr>';
177
178 if (!empty($context['user']['avatar']))
179 echo '<td valign="middle">', $context['user']['avatar']['image'], '</td>';
180
181 echo '<td valign="top" class="smalltext" style="width: 100%; font-family: verdana, arial, sans-serif;">';
182
183 // If the user is logged in, display stuff like their name, new messages, etc.
184 if ($context['user']['is_logged'])
185 {
186 echo '
187 ', $txt['hello_member'], ' <b>', $context['user']['name'], '</b>';
188
189 // Only tell them about their messages if they can read their messages!
190 if ($context['allow_pm'])
191 echo ', ', $txt[152], ' <a href="', $scripturl, '?action=pm">', $context['user']['messages'], ' ', $context['user']['messages'] != 1 ? $txt[153] : $txt[471], '</a>', $txt['newmessages4'], ' ', $context['user']['unread_messages'], ' ', $context['user']['unread_messages'] == 1 ? $txt['newmessages0'] : $txt['newmessages1'];
192 echo '.<br />';
193
194 // Is the forum in maintenance mode?
195 if ($context['in_maintenance'] && $context['user']['is_admin'])
196 echo '
197 <b>', $txt[616], '</b><br />';
198
199 // Are there any members waiting for approval?
200 if (!empty($context['unapproved_members']))
201 echo '
202 ', $context['unapproved_members'] == 1 ? $txt['approve_thereis'] : $txt['approve_thereare'], ' <a href="', $scripturl, '?action=viewmembers;sa=browse;type=approve">', $context['unapproved_members'] == 1 ? $txt['approve_member'] : $context['unapproved_members'] . ' ' . $txt['approve_members'], '</a> ', $txt['approve_members_waiting'], '<br />';
203
204 // Show the total time logged in?
205 if (!empty($context['user']['total_time_logged_in']))
206 {
207 echo '
208 ', $txt['totalTimeLogged1'];
209
210 // If days is just zero, don't bother to show it.
211 if ($context['user']['total_time_logged_in']['days'] > 0)
212 echo $context['user']['total_time_logged_in']['days'] . $txt['totalTimeLogged2'];
213
214 // Same with hours - only show it if it's above zero.
215 if ($context['user']['total_time_logged_in']['hours'] > 0)
216 echo $context['user']['total_time_logged_in']['hours'] . $txt['totalTimeLogged3'];
217
218 // But, let's always show minutes - Time wasted here: 0 minutes ;).
219 echo $context['user']['total_time_logged_in']['minutes'], $txt['totalTimeLogged4'], '<br />';
220 }
221
222 echo '
223 <a href="', $scripturl, '?action=unread">', $txt['unread_since_visit'], '</a><br />
224 <a href="', $scripturl, '?action=unreadreplies">', $txt['show_unread_replies'], '</a><br />
225 ', $context['current_time'];
226 }
227 // Otherwise they're a guest - so politely ask them to register or login.
228 else
229 {
230 echo '
231 ', $txt['welcome_guest'], '<br />
232 ', $context['current_time'], '<br />
233
234 <script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/sha1.js"></script>
235
236 <form action="', $scripturl, '?action=login2" method="post" accept-charset="', $context['character_set'], '" style="margin: 3px 1ex 1px 0;"', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' . $context['session_id'] . '\');"' : '', '>
237 <div style="text-align: right;">
238 <input type="text" name="user" size="10" /> <input type="password" name="passwrd" size="10" />
239 <select name="cookielength">
240 <option value="60">', $txt['smf53'], '</option>
241 <option value="1440">', $txt['smf47'], '</option>
242 <option value="10080">', $txt['smf48'], '</option>
243 <option value="43200">', $txt['smf49'], '</option>
244 <option value="-1" selected="selected">', $txt['smf50'], '</option>
245 </select>
246 <input type="submit" value="', $txt[34], '" /><br />
247 ', $txt['smf52'], '
248 <input type="hidden" name="hash_passwrd" value="" />
249 </div>
250 </form>';
251 }
252
253 echo '
254 </td></tr></table>
255 </div>
256
257 <form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '" style="margin: 0;">
258 <div style="margin-top: 7px;">
259 <b>', $txt[182], ': </b><input type="text" name="search" value="" style="width: 190px;" />&nbsp;
260 <input type="submit" name="submit" value="', $txt[182], '" style="width: 8ex;" />&nbsp;
261 <a href="', $scripturl, '?action=search;advanced">', $txt['smf298'], '</a>
262 <input type="hidden" name="advanced" value="0" />';
263
264 // Search within current topic?
265 if (!empty($context['current_topic']))
266 echo '
267 <input type="hidden" name="topic" value="', $context['current_topic'], '" />';
268
269 // If we're on a certain board, limit it to this board ;).
270 elseif (!empty($context['current_board']))
271 echo '
272 <input type="hidden" name="brd[', $context['current_board'], ']" value="', $context['current_board'], '" />';
273
274 echo '
275 </div>
276 </form>
277
278 </td>
279 <td style="width: 262px; ', !$context['right_to_left'] ? 'padding-left' : 'padding-right', ': 6px;" valign="top">';
280
281 // Show a random news item? (or you could pick one from news_lines...)
282 if (!empty($settings['enable_news']))
283 echo '
284 <div class="headertitles" style="width: 260px;"><img src="', $settings['images_url'], '/blank.gif" height="12" alt="" /></div>
285 <div class="headerbodies" style="width: 260px; position: relative; background-image: url(', $settings['images_url'], '/box_bg.gif); margin-bottom: 8px;">
286 <img src="', $settings['images_url'], '/', $context['user']['language'], '/newsbox.gif" style="position: absolute; left: -1px; top: -16px;" alt="" />
287 <div style="height: 50px; overflow: auto; padding: 5px;" class="smalltext">', $context['random_news_line'], '</div>
288 </div>';
289
290 // The "key stats" box.
291 echo '
292 <div class="headertitles" style="width: 260px;"><img src="', $settings['images_url'], '/blank.gif" height="12" alt="" /></div>
293 <div class="headerbodies" style="width: 260px; position: relative; background-image: url(', $settings['images_url'], '/box_bg.gif);">
294 <img src="', $settings['images_url'], '/', $context['user']['language'], '/keystats.gif" style="position: absolute; left: -1px; top: -16px;" alt="" />
295 <div style="', !$context['browser']['is_ie'] ? 'min-height: 35px;' : 'height: 4em;', ' padding: 5px;" class="smalltext">
296 <b>', $context['common_stats']['total_posts'], '</b> ', $txt[95], ' ', $txt['smf88'], ' <b>', $context['common_stats']['total_topics'], '</b> ', $txt[64], ' ', $txt[525], ' <span style="white-space: nowrap;"><b>', $context['common_stats']['total_members'], '</b> ', $txt[19], '</span><br />
297 ', $txt[656], ': <b> ', $context['common_stats']['latest_member']['link'], '</b>
298 </div>
299 </div>';
300
301 echo '
302 </td>
303 </tr>
304 </table>
305
306 <a href="javascript:void(0);" onclick="shrinkHeader(!current_header); return false;"><img id="upshrink" src="', $settings['images_url'], '/', empty($options['collapse_header']) ? 'upshrink.gif' : 'upshrink2.gif', '" alt="*" title="', $txt['upshrink_description'], '" style="margin: 2px 2ex 2px 0;" border="0" /></a>';
307
308 // Show the menu here, according to the menu sub template.
309 template_menu();
310
311 echo '
312 </div>';
313
314 // The main content should go here. A table is used because IE 6 just can't handle a div.
315 echo '
316 <table width="100%" cellpadding="0" cellspacing="0" border="0"><tr>
317 <td id="bodyarea" style="padding: 1ex 20px 2ex 20px;">';
318 }
319
320 function template_main_below()
321 {
322 global $context, $settings, $options, $scripturl, $txt;
323
324 echo '</td>
325 </tr></table>';
326
327 // Show the "Powered by" and "Valid" logos, as well as the copyright. Remember, the copyright must be somewhere!
328 echo '
329
330 <div id="footerarea" style="text-align: center; padding-bottom: 1ex;', $context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? ' width: 100%;' : '', '">
331 <script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
332 function smfFooterHighlight(element, value)
333 {
334 element.src = smf_images_url + "/" + (value ? "h_" : "") + element.id + ".gif";
335 }
336 // ]]></script>
337 <table cellspacing="0" cellpadding="3" border="0" width="100%">
338 <tr>
339 <td width="28%" valign="middle" align="', !$context['right_to_left'] ? 'right' : 'left', '">
340 <a href="http://www.mysql.com/" target="_blank"><img id="powered-mysql" src="', $settings['images_url'], '/powered-mysql.gif" alt="', $txt['powered_by_mysql'], '" width="54" height="20" style="margin: 5px 16px;" border="0" onmouseover="smfFooterHighlight(this, true);" onmouseout="smfFooterHighlight(this, false);" /></a>
341 <a href="http://www.php.net/" target="_blank"><img id="powered-php" src="', $settings['images_url'], '/powered-php.gif" alt="', $txt['powered_by_php'], '" width="54" height="20" style="margin: 5px 16px;" border="0" onmouseover="smfFooterHighlight(this, true);" onmouseout="smfFooterHighlight(this, false);" /></a>
342 </td>
343 <td valign="middle" align="center" style="white-space: nowrap;">
344 ', theme_copyright(), '
345 </td>
346 <td width="28%" valign="middle" align="', !$context['right_to_left'] ? 'left' : 'right', '">
347 <a href="http://validator.w3.org/check/referer" target="_blank"><img id="valid-xhtml10" src="', $settings['images_url'], '/valid-xhtml10.gif" alt="', $txt['valid_xhtml'], '" width="54" height="20" style="margin: 5px 16px;" border="0" onmouseover="smfFooterHighlight(this, true);" onmouseout="smfFooterHighlight(this, false);" /></a>
348 <a href="http://jigsaw.w3.org/css-validator/check/referer" target="_blank"><img id="valid-css" src="', $settings['images_url'], '/valid-css.gif" alt="', $txt['valid_css'], '" width="54" height="20" style="margin: 5px 16px;" border="0" onmouseover="smfFooterHighlight(this, true);" onmouseout="smfFooterHighlight(this, false);" /></a>
349 </td>
350 </tr>
351 </table>';
352
353 // Show the load time?
354 if ($context['show_load_time'])
355 echo '
356 <span class="smalltext">', $txt['smf301'], $context['load_time'], $txt['smf302'], $context['load_queries'], $txt['smf302b'], '</span>';
357
358 echo '
359 </div>';
360
361 // This is an interesting bug in Internet Explorer AND Safari. Rather annoying, it makes overflows just not tall enough.
362 if (($context['browser']['is_ie'] && !$context['browser']['is_ie4']) || $context['browser']['is_mac_ie'] || $context['browser']['is_safari'] || $context['browser']['is_firefox'])
363 {
364 // The purpose of this code is to fix the height of overflow: auto div blocks, because IE can't figure it out for itself.
365 echo '
366 <script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[';
367
368 // Unfortunately, Safari does not have a "getComputedStyle" implementation yet, so we have to just do it to code...
369 if ($context['browser']['is_safari'])
370 echo '
371 window.addEventListener("load", smf_codeFix, false);
372
373 function smf_codeFix()
374 {
375 var codeFix = document.getElementsByTagName ? document.getElementsByTagName("div") : document.all.tags("div");
376
377 for (var i = 0; i < codeFix.length; i++)
378 {
379 if ((codeFix[i].className == "code" || codeFix[i].className == "post" || codeFix[i].className == "signature") && codeFix[i].offsetHeight < 20)
380 codeFix[i].style.height = (codeFix[i].offsetHeight + 20) + "px";
381 }
382 }';
383 elseif ($context['browser']['is_firefox'])
384 echo '
385 window.addEventListener("load", smf_codeFix, false);
386 function smf_codeFix()
387 {
388 var codeFix = document.getElementsByTagName ? document.getElementsByTagName("div") : document.all.tags("div");
389
390 for (var i = 0; i < codeFix.length; i++)
391 {
392 if (codeFix[i].className == "code" && (codeFix[i].scrollWidth > codeFix[i].clientWidth || codeFix[i].clientWidth == 0))
393 codeFix[i].style.overflow = "scroll";
394 }
395 }';
396 else
397 {
398 echo '
399 var window_oldOnload = window.onload;
400 window.onload = smf_codeFix;
401
402 function smf_codeFix()
403 {
404 var codeFix = document.getElementsByTagName ? document.getElementsByTagName("div") : document.all.tags("div");
405
406 for (var i = codeFix.length - 1; i > 0; i--)
407 {
408 if (codeFix[i].currentStyle.overflow == "auto" && (codeFix[i].currentStyle.height == "" || codeFix[i].currentStyle.height == "auto") && (codeFix[i].scrollWidth > codeFix[i].clientWidth || codeFix[i].clientWidth == 0) && (codeFix[i].offsetHeight != 0 || codeFix[i].className == "code"))
409 codeFix[i].style.height = (codeFix[i].offsetHeight + 36) + "px";
410 }
411
412 if (window_oldOnload)
413 {
414 window_oldOnload();
415 window_oldOnload = null;
416 }
417 }';
418 }
419
420 echo '
421 // ]]></script>';
422 }
423
424 // The following will be used to let the user know that some AJAX process is running
425 echo '
426 <div id="ajax_in_progress" style="display: none;', $context['browser']['is_ie'] && !$context['browser']['is_ie7'] ? 'position: absolute;' : '', '">', $txt['ajax_in_progress'], '</div>
427 </body>
428 </html>';
429 }
430
431 // Show a linktree. This is that thing that shows "My Community | General Category | General Discussion"..
432 function theme_linktree()
433 {
434 global $context, $settings, $options;
435
436 // Folder style or inline? Inline has a smaller font.
437 echo '<span class="nav"', $settings['linktree_inline'] ? ' style="font-size: smaller;"' : '', '>';
438
439 // Each tree item has a URL and name. Some may have extra_before and extra_after.
440 foreach ($context['linktree'] as $link_num => $tree)
441 {
442 // Show the | | |-[] Folders.
443 if (!$settings['linktree_inline'])
444 {
445 if ($link_num > 0)
446 echo str_repeat('<img src="' . $settings['images_url'] . '/icons/linktree_main.gif" alt="| " border="0" />', $link_num - 1), '<img src="' . $settings['images_url'] . '/icons/linktree_side.gif" alt="|-" border="0" />';
447 echo '<img src="' . $settings['images_url'] . '/icons/folder_open.gif" alt="+" border="0" />&nbsp; ';
448 }
449
450 // Show something before the link?
451 if (isset($tree['extra_before']))
452 echo $tree['extra_before'];
453
454 // Show the link, including a URL if it should have one.
455 echo '<b>', $settings['linktree_link'] && isset($tree['url']) ? '<a href="' . $tree['url'] . '" class="nav">' . $tree['name'] . '</a>' : $tree['name'], '</b>';
456
457 // Show something after the link...?
458 if (isset($tree['extra_after']))
459 echo $tree['extra_after'];
460
461 // Don't show a separator for the last one.
462 if ($link_num != count($context['linktree']) - 1)
463 echo $settings['linktree_inline'] ? ' &nbsp;|&nbsp; ' : '<br />';
464 }
465
466 echo '</span>';
467 }
468
469 // Show the menu up top. Something like [home] [help] [profile] [logout]...
470 function template_menu()
471 {
472 global $context, $settings, $options, $scripturl, $txt;
473
474 // Show the [home] and [help] buttons.
475 echo '
476 <a href="', $scripturl, '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/home.gif" alt="' . $txt[103] . '" style="margin: 2px 0;" border="0" />' : $txt[103]), '</a>', $context['menu_separator'], '
477 <a href="', $scripturl, '?action=help">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/help.gif" alt="' . $txt[119] . '" style="margin: 2px 0;" border="0" />' : $txt[119]), '</a>', $context['menu_separator'];
478
479 // How about the [search] button?
480 if ($context['allow_search'])
481 echo '
482 <a href="', $scripturl, '?action=search">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/search.gif" alt="' . $txt[182] . '" style="margin: 2px 0;" border="0" />' : $txt[182]), '</a>', $context['menu_separator'];
483
484 // Is the user allowed to administrate at all? ([admin])
485 if ($context['allow_admin'])
486 echo '
487 <a href="', $scripturl, '?action=admin">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin.gif" alt="' . $txt[2] . '" style="margin: 2px 0;" border="0" />' : $txt[2]), '</a>', $context['menu_separator'];
488
489 // Edit Profile... [profile]
490 if ($context['allow_edit_profile'])
491 echo '
492 <a href="', $scripturl, '?action=profile">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/profile.gif" alt="' . $txt[79] . '" style="margin: 2px 0;" border="0" />' : $txt[467]), '</a>', $context['menu_separator'];
493
494 // The [calendar]!
495 if ($context['allow_calendar'])
496 echo '
497 <a href="', $scripturl, '?action=calendar">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/calendar.gif" alt="' . $txt['calendar24'] . '" style="margin: 2px 0;" border="0" />' : $txt['calendar24']), '</a>', $context['menu_separator'];
498
499 // If the user is a guest, show [login] and [register] buttons.
500 if ($context['user']['is_guest'])
501 {
502 echo '
503 <a href="', $scripturl, '?action=login">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/login.gif" alt="' . $txt[34] . '" style="margin: 2px 0;" border="0" />' : $txt[34]), '</a>', $context['menu_separator'], '
504 <a href="', $scripturl, '?action=register">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/register.gif" alt="' . $txt[97] . '" style="margin: 2px 0;" border="0" />' : $txt[97]), '</a>';
505 }
506 // Otherwise, they might want to [logout]...
507 else
508 echo '
509 <a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/logout.gif" alt="' . $txt[108] . '" style="margin: 2px 0;" border="0" />' : $txt[108]), '</a>';
510 }
511
512 // Generate a strip of buttons, out of buttons.
513 function template_button_strip($button_strip, $direction = 'top', $force_reset = false, $custom_td = '')
514 {
515 global $settings, $buttons, $context, $txt, $scripturl;
516
517 if (empty($button_strip))
518 return '';
519
520 // Create the buttons...
521 foreach ($button_strip as $key => $value)
522 {
523 if (isset($value['test']) && empty($context[$value['test']]))
524 {
525 unset($button_strip[$key]);
526 continue;
527 }
528 elseif (!isset($buttons[$key]) || $force_reset)
529 $buttons[$key] = '<a href="' . $value['url'] . '" ' .( isset($value['custom']) ? $value['custom'] : '') . '>' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . ($value['lang'] ? $context['user']['language'] . '/' : '') . $value['image'] . '" alt="' . $txt[$value['text']] . '" border="0" />' : $txt[$value['text']]) . '</a>';
530
531 $button_strip[$key] = $buttons[$key];
532 }
533
534 echo '
535 <td ', $custom_td, '>', implode($context['menu_separator'], $button_strip) , '</td>';
536 }
537
538 ?>